dhtml update
authorØyvind Kolås <ok@src.gnome.org>
Thu, 8 Sep 2005 16:54:35 +0000 (16:54 +0000)
committerØyvind Kolås <ok@src.gnome.org>
Thu, 8 Sep 2005 16:54:35 +0000 (16:54 +0000)
ChangeLog
docs/Makefile.am
docs/babl.css
docs/graphics/Makefile.am
docs/index-static.html.in
tests/babl-html-dump.c

index 562c1b9e614bbba12b75616c8383d1142ea79218..ea044c250611980f23d4d2859ea7c65107772cdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-09-08  Øyvind Kolås  <pippin@gimp.org>
+
+       * AUTHORS: Added Micahel Schumacher, and email addresses.
+       * docs/index-static.html.in:
+       * docs/babl.css:
+       * tests/babl-html-dump.c: (main), (normalize), (show_item),
+       (hide_item), (each_item), (model_html), (type_html),
+       (conversion_html), (format_html): Use DHTML for expandable display of
+       registered data structures.
+       * docs/graphics/Makefile.am: added web target, and .SILENT option.
+       * docs/Makefile.am: added .SILENT option.
+
 2005-09-01  Michael Schumacher  <schumaml@cvs.gnome.org>
 
        * configure.ac: added a check for OS_WIN32
index 2d946f13286bc16f6abad7335a5859294d925710..bf538b662c0b3848a5b505410f9a8c5147a45a75 100644 (file)
@@ -1,9 +1,10 @@
+.SILENT:
 SUBDIRS=      graphics
 DIST_SUBDIRS= graphics
 
 # The patterns used for html creation in the babl build system
 # is very small, and should probably be documented in a tutorial.
-#
+#      
 #
 #
 HTML_FILES = index-static.html         \
@@ -25,7 +26,10 @@ MAINTAINERCLEANFILES = index.html
 
 all: $(HTML_FILES)
 
+
+
 index.html: index-static.html $(top_builddir)/tests/babl_html_dump $(top_srcdir)/AUTHORS  $(top_srcdir)/NEWS
+       echo -n "HTML: $@"
        cp $< $@ 
        (TMPFILE=`tempfile`;\
        $(top_builddir)/tests/babl_html_dump > $$TMPFILE;\
@@ -34,8 +38,29 @@ index.html: index-static.html $(top_builddir)/tests/babl_html_dump $(top_srcdir)
 
        $(top_srcdir)/docs/tools/xml_insert.sh $@ AUTHORS $(top_srcdir)/AUTHORS
        $(top_srcdir)/docs/tools/xml_insert.sh $@ NEWS $(top_srcdir)/NEWS
+       echo " [OK]"
 
 distclean-local:
        if test $(srcdir) = .; then :; else     \
                rm -f $(BUILT_EXTRA_DIST);      \
        fi
+
+
+web: all graphics
+       echo -n " WEB: "
+       ping -c 1 $(WEBSITE_HOST) >/dev/null && \
+          (\
+             scp *.html *.css\
+                 "$(WEBSITE_HOST):$(WEBSITE_LOCATION)/" >/dev/null && \
+                 echo -n "."; \
+             scp graphics/*.png graphics/*.html\
+                 "$(WEBSITE_HOST):$(WEBSITE_LOCATION)/graphics/" >/dev/null\
+               &&\
+                 echo "[OK]"\
+               ||\
+                 echo "FAIL   scp failed (does dirs exist?)."\
+          )\
+       || \
+          (\
+          echo "FAIL   $(WEBSITE_HOST) not reachable."\
+          )
index 6caa3f183350bb4bc425f399e786741ada5db6a5..79e62ec9fd16a5a55ad999a70e95e10ed7ebb3a9 100644 (file)
         margin-bottom: 1em;
       }
 
-      table {
-        margin-top: 1em;
-        margin-bottom: 1em;
-        width: 100%;
+      div.expander {
+        border: 1px solid #bbb;
+      }
+      div.expander_title {
+        border-bottom: 1px solid #aaa;
+      }
+      div.expander_content {
+        margin-left: 3em;
+        display: none;
+        padding-bottom: 1em;
+      }
+      div.expander_content dl{
+        margin: 0;
+        padding: 0;
       }
+
       table th {
         font-weight: normal;
         background-color: #ccc;
         color: white;
         border: 1px solid white;
       }
+
+      .nopad {
+        margin :0;
+        padding:0;
+      }
+
+      td.component {
+        background-color: #060;
+        padding-left: 0.5em;
+        padding-top: 0.1em;
+        padding-bottom: 0.1em;
+        overflow: hidden;
+        width: 4em;
+        color: white;
+        border: 1px solid white;
+      }
+      td.type {
+        background-color: #006;
+        padding-left: 0.5em;
+        padding-top: 0.1em;
+        padding-bottom: 0.1em;
+        overflow: hidden;
+        width: 4em;
+        color: white;
+        border: 1px solid white;
+      }
       span.spacer {
         float: left;
         display: block;
index d4d9719ad66389b8c588a4c1f42d59b110484f2c..d87b1373964713b0f8ac5d30345f03ed0f6f50e9 100644 (file)
@@ -1,3 +1,5 @@
+.SILENT:
+
 if HAVE_INKSCAPE
 PNG_FILES =                    \
        babl-a4poster.png       \
@@ -20,18 +22,30 @@ MAINTAINERCLEANFILES = $(PNG_FILES)
 
 all: $(MAINTAINERCLEANFILES)
 
+INKSCAPE_CMD = echo -n " SVG: $@" ;\
+  $(INKSCAPE) -e $@ $< 2&>/dev/null\
+    &&\
+      echo " [OK]"\
+    ||\
+      echo " FAIL"
 
 if HAVE_INKSCAPE
 dist-check-inkscape:
 
 %.png: %.svg
-       $(INKSCAPE) -e $@ $<
+       $(INKSCAPE_CMD)
+#-e $@ $< 2>/dev/null
 
 # the png version of the a4 poster is used as a webgraphic
 # , thus it is rendered with the background alpha set to
 # 0.0
 babl-a4poster.png: babl-a4poster.svg
-       $(INKSCAPE) -e $@ $< -w 256 -y 0
+       echo -n " SVG: $@" ;\
+       $(INKSCAPE) -e $@ $< -w 256 -y 0 2&>/dev/null\
+         &&\
+           echo " [OK]"\
+         ||\
+           echo " FAIL"
 else
 dist-check-inkscape:
        @echo "*** inkscape must be available in order to make dist"
index 9be70023258b57a1edf9659bdd02f5872a8b82e0..ff707ef9d4add9eecdeed2b924602684f20aa02e 100644 (file)
     <style type='text/css'>
        @import url(babl.css);
     </style>
+
+    <script type='text/javascript'>
+        function hide(id)
+        {
+          (document.getElementById(id)).style.display = "none";
+        }
+        function show(id)
+        {
+          (document.getElementById(id)).style.display = "block";
+        }
+    function get_visible (id)
+    {
+      var element = document.getElementById(id);
+
+      if (element &&
+          element.style.display &&
+          element.style.display != "none")
+         return true;
+      return false;
+    }
+
+    function set_visible (id, visible)
+    {
+      var element = document.getElementById(id);
+
+      if (element)
+        {
+          if (visible)
+              element.style.display = "block";
+          else
+              element.style.display = "none";
+        }
+    }
+    function toggle_visible (id)
+    {
+      if (get_visible(id))
+        set_visible(id, false);
+      else
+        set_visible(id,true);
+    }
+
+    </script>
   </head>
   <body>
 
         <li><a href='#Color-models'>&nbsp;&nbsp;Color models</a></li>
         <li><a href='#Pixel-formats'>&nbsp;&nbsp;Pixel formats</a></li>
         <li><a href='#Dependencies'>Dependencies</a></li>
-        <li><a href='#Dependencies-Core'>&nbsp;&nbsp;Core</a></li>
-        <li><a href='#Dependencies-Extensions'>&nbsp;&nbsp;Extensions</a></li>
         <li><a href='#Source'>Source</a></li>
         <li><a href='#Usage'>Usage</a></li>
         <li><a href='#Extending'>Extending</a></li>
-        <li><a href='#TODO'>TODO</a></li>
-        <li><a href='#TODO-Core'>&nbsp;&nbsp;Core</a></li>
-        <li><a href='#TODO-Extensions'>&nbsp;&nbsp;Extensions</a></li>
+        <li><a href='#TODO'>Todo</a></li>
         <li><a href='#Copyright'>Copyright</a></li>
         <li><a href='#Authors'>&nbsp;&nbsp;Authors</a></li>
       </ul>
         <h3>Core</h3>
         <ul>
           <li class='frozen'>Small API for simple use cases</li>
-          <li class='stable'>Specification of new formats</li>
           <li class='stable'>Planar and linear buffers</li>
           <li class='stable'>Thread safety for processing.</li>
 
-          <li class='unstable'>Extension and <a href='http://pippin.gimp.org/babl/introspect.txt'>introspection</a> of formats,
+          <li class='unstable'>Extendable and <a href='http://pippin.gimp.org/babl/introspect.txt'>introspectable</a> formats,
           color models, components and datatypes</li>
-          <li class='unstable'>Horizontal an vertical subsampling (for
-          implementing 4:2:2 4:2:0 4:1:1 etc. chroma subsampling)</li>
-          <li class='unstable'>Reference 64bit floating point conversions for data types and color models.
-          
-          <p><em>Note:</em> This portion of babl has still not received rigorous
-          testing, the main development of babl is still focused on internal
-          infrastructure work. As the development of babl allows, initial tests
-          and usage of babl is welcome; as it would help kill of random
-          mystypes in constants and such earlier, and make it a more valid
-          actual regression suite.
-          </p>
+          <li class='unstable'>Reference 64bit floating point conversions for
+          data types and color models.
 <!--BablBase-->
           </li>
         </ul>
           </dl>
           </li>
         </ul>
-        <p>
-        The extension api is not going to be frozen until after the 1.0 release.
-        </p>
 
 
         <a name='Dependencies'></a>
         <p> Babl is intended to be a low level infrastructure library and thus
         strives for few dependencies and thus portability. </p>
 
-        <a name='Dependencies-Core'></a>
-        <h3>Core</h3>
-        <ul>
-          <li>The C Standard library.</li>
-        </ul>
-
-        <a name='Dependencies-Extensions'></a>
-        <h3>Extensions</h3>
         <ul>
-          <li>libdl - dynamic modules. (planned)</li>
+          <li>libdl (win32 uses separate solution)</li>
         </ul>
 
 
         </p>
         
         <a name='TODO'></a>
-        <a name='TODO-Core'></a>
         <h2>TODO</h2>
         
-        <h3>Core</h3>
         <ul>
-          <li>Speed up name resolution in babl-db.h (using a hash table, and
-              probably also a id table)</li>
-          <li>Meta level optimizations.</li>
           <li>Compile and/or runtime profiling. <em>(The speed of conversions
             is bound to 'wobble', according to architecture, compiler flags,
             concurrently running processes and phase of moon.)</em></li>
-          <li>Subsampling support</li>
-          <li>Support for datatypes that are not a multiple of 8bit.</li>
+          <li class='unstable'>Horizontal and vertical subsampling (for
+          implementing 4:2:2 4:2:0 4:1:1 etc. chroma subsampling)</li>
           <li>Thread safety for mutations of the type system.</li>
+          <li>Support for datatypes that are not a multiple of 8bit.</li>
           <!--<li>Relative error is the difference between the two vaues
           divided by the actual value, for instance, if the actual result of a
           calculation should be 3.13159, but the result obtained was 3.14x10^0,
@@ -228,30 +241,6 @@ cp babl/babl-classes.c      babl/babl-internal.c
 -->
         </ul>
 
-        <a name='TODO-Extensions'></a>
-        <h3>Extensions</h3>
-        <ul>
-          <li>Dynamic modules
-          babl will probably look in a colon
-          seperated list of paths to search sequentially for modules. 
-          The default assumed value is
-          <pre>BABL_PATH="/usr/lib/babl/:/usr/local/lib/babl:(HOME)/.local/lib/babl:$(HOME)/lib/babl".
-          </pre>
-          NB: the modules will be loaded from the directories pointed to by
-          the path in reverse order, this should allow the user to override
-          system wide definitions for types, models and formats.
-          
-          <p><b>currently the extensions are hardcoded to be installed in /home/pippin/.babl/
-          and the only extensions looked for are naive-CMYK.so and CIE-Lab.so this will change
-          shortly. Look in babl/babl-extension.c (bottom)   and  extensions/Makefile.in  to
-          change it if you so desire.</b></p>
-          
-          
-          </li>
-          
-        </ul>
-
-
 
         <a name='Copyright'></a>
         <h2>Copyright</h2>
@@ -264,15 +253,7 @@ cp babl/babl-classes.c      babl/babl-internal.c
         <a name='Authors'></a>
         <h3>Authors</h3>
 
-        <dl>
-          <dt>Maintainer:</dt>
-          <dd><a href='http://pippin.gimp.org/'>Øyvind Kolås</a></dd>
-          <dt>Original author:</dt>
-          <dd>Øyvind Kolås</dd>
-          <dt>Contributors:<dt>
-<dd><pre class='authors'><!--AUTHORS-->          
-</pre></dd>
-        </dl>
+<!--AUTHORS-->          
      
         <a href='graphics/index.html'><img class='BablFish' alt='/babl-@BABL_VERSION@' title='babl-@BABL_VERSION@' src='graphics/babl-48x48.png'/></a>
       </div>
index d33aab599c9acf2a26c4670f38948a228e480aa7..eb2e8e721f28a736dcaa4194fc7eb45fa34d5f4b 100644 (file)
 static void model_html              (Babl *babl);
 static void type_html               (Babl *babl);
 static void format_html             (Babl *babl);
+static void conversion_html         (Babl *babl);
 
 static int  each_item               (Babl *babl,
                                      void *user_data);
+static int  show_item               (Babl *babl,
+                                     void *user_data);
+static int  hide_item               (Babl *babl,
+                                     void *user_data);
+
 
 int
 main (void)
 {
   babl_init ();
 
-
-  printf ("<a name='Data-types'></a>\n");
-  printf ("<table><tr><th>Data type</th><th>bits</th><th>bytes</th></tr>\n");
+  printf ("<br/><a href='javascript:");
+  printf ("show(\"x_types\");show(\"x_models\");show(\"x_formats\");show(\"x_conversions\");");
+  babl_type_each (show_item, NULL);
+  babl_model_each (show_item, NULL);
+  babl_format_each (show_item, NULL);
+  babl_conversion_each (show_item, NULL);
+  printf ("'>+</a>");
+
+  printf ("<a href='javascript:");
+  printf ("hide(\"x_types\");hide(\"x_models\");hide(\"x_formats\");hide(\"x_conversions\");");
+  babl_type_each (hide_item, NULL);
+  babl_model_each (hide_item, NULL);
+  babl_format_each (hide_item, NULL);
+  babl_conversion_each (hide_item, NULL);
+  printf ("'>-</a>");
+
+  printf ("<div class='expander'>");
+  printf ("<div class='expander_title'><a style='font-size:110%%' name='Data-types' href='javascript:toggle_visible(\"x_types\")'>Data types</a></div><div class='expander_content' id='x_types'>\n");
   babl_type_each (each_item, NULL);
-  printf ("<tr><td><a name='Color-models'></a>&nbsp;</td></tr>\n");
-  printf ("<tr><th>Color model</th><th>components</th></tr>\n");
+  printf ("</div>\n");
+  printf ("</div>\n");
+
+  printf ("<div class='expander'>");
+  printf ("<div class='expander_title'><a style='font-size:110%%' name='Color-models' href='javascript:toggle_visible(\"x_models\")'>Color models</a></div><div class='expander_content' id='x_models'>\n");
   babl_model_each (each_item, NULL);
-  printf ("<tr><td><a name='Pixel-formats'></a>&nbsp;</td></tr>\n");
-  printf ("<tr><th>Pixel format</th><th>bytes/pixel</th><th>color model</th><th>bands</th> </tr>\n");
+  printf ("</div>\n");
+  printf ("</div>\n");
+
+
+  printf ("<div class='expander'>");
+  printf ("<div class='expander_title'><a style='font-size:110%%' name='Pixel-formats' href='javascript:toggle_visible(\"x_formats\")'>Pixel formats</a></div><div class='expander_content' id='x_formats'>\n");
   babl_format_each (each_item, NULL);
-  printf ("</table>\n");
+  printf ("</div>\n");
+  printf ("</div>\n");
+
+
+  printf ("<div class='expander'>");
+  printf ("<div class='expander_title'><a style='font-size:110%%' name='Conversions' href='javascript:toggle_visible(\"x_conversions\")'>Conversions</a></div><div class='expander_content' id='x_conversions'>\n");
+  babl_conversion_each (each_item, NULL);
+  printf ("</div>\n");
+  printf ("</div>\n");
 
   babl_destroy ();
 
   return 0;
 }
 
+
+static char normalized_buf[512];
+
+const char *normalize(const char *str)
+{
+  char *s = normalized_buf;
+  strcpy (normalized_buf, str);
+
+  while (*s)
+    {
+      if ( (*s >= 'a' && *s <= 'z') ||
+           (*s >= 'A' && *s <= 'Z') ||
+           (*s >= '0' && *s <= '9'))
+        {
+        }
+      else
+        {
+          *s='_';
+        }
+      s++;
+    }
+  return normalized_buf;
+}
+
+
+static int
+show_item (Babl *babl,
+           void *user_data)
+{
+  printf ("show(\"x_%s\");", normalize(babl->instance.name));
+  return 0;
+}
+
+
+static int
+hide_item (Babl *babl,
+           void *user_data)
+{
+  printf ("hide(\"x_%s\");", normalize(babl->instance.name));
+  return 0;
+}
+
 static int
 each_item (Babl *babl,
-              void *user_data)
+           void *user_data)
 {
-  printf ("\t<tr><td valign='top'><span class='name'>%s</span></td>", babl->instance.name);
+  printf ("<div class='expander'>");
+  printf ("<div class='expander_title'><a href='javascript:toggle_visible(\"x_%s\")'>%s</a></div>\n",
+      normalize(babl->instance.name), babl->instance.name);
+  printf ("<div class='expander_content' id='x_%s'>\n",
+      normalize (babl->instance.name));
+
 
   switch (babl->class_type)
     {
@@ -65,11 +148,18 @@ each_item (Babl *babl,
       case BABL_FORMAT:
         format_html (babl);
         break;
+      case BABL_CONVERSION:
+      case BABL_CONVERSION_LINEAR:
+      case BABL_CONVERSION_PLANE:
+      case BABL_CONVERSION_PLANAR:
+        conversion_html (babl);
+        break;
       default:
         break;
     }
 
-  printf ("</tr>\n");
+  printf ("</div>\n");
+  printf ("</div>\n");
   return 0;
 }
 
@@ -78,19 +168,29 @@ model_html (Babl *babl)
 {
   int i;
 
-  printf ("<td>");
+  printf ("<dl>");
+  printf ("<dt>components</dt><dd><table class='nopad'>");
+
   for (i=0; i< babl->model.components; i++)
     {
-      printf ("<span class='component'>%s</span><span class='spacer'>&nbsp;</span><br/>", BABL(babl->model.component[i])->instance.name  );
+      printf ("<tr><td class='type'>%s</td></tr>",
+       BABL(babl->model.component[i])->instance.name  );
     }
-  printf ("</td>");
+  printf ("</table></dd></dl>");
 }
 
 static void
 type_html (Babl *babl)
 {
-  printf ("<td>%i</td>", babl->type.bits);
-  printf ("<td>%i</td>", babl->type.bits / 8);
+  printf ("<dl><dt>bits</dt><dd>%i</dd>", babl->type.bits);
+  printf ("<dt>bytes</dt><dd>%i</dd></dl>", babl->type.bits / 8);
+}
+
+
+static void
+conversion_html (Babl *babl)
+{
+  printf ("\n");
 }
 
 static void
@@ -98,32 +198,17 @@ format_html (Babl *babl)
 {
   int i;
 
-  printf ("<td valign='top'>");
-  printf ("<span class='name'>%i</span>", babl->format.bytes_per_pixel);
-  printf ("</td>");
-  printf ("<td valign='top'>");
-  printf ("<span class='name'>%s</span>", BABL(babl->format.model)->instance.name  );
-  printf ("</td>");
-  printf ("<td>");
+  printf ("<dl>");
+  printf ("<dt>bytes/pixel</dt><dd>%i</dd>", babl->format.bytes_per_pixel);
+  printf ("<dt>model</dt><dd>%s</dd>", BABL(babl->format.model)->instance.name  );
+  printf ("<dt>components</dt><dd><table class='nopad'>");
+
   for (i=0; i< babl->format.components; i++)
     {
-      printf ("<span class='type'>%s </span><span class='component'>%s</span><span class='spacer'>&nbsp;</span><br/>",
+      printf ("<tr><td class='type'>%s</td><td class='component'>%s</td></tr>",
        BABL(babl->format.type[i])->instance.name,
        BABL(babl->format.component[i])->instance.name  );
     }
-  printf ("</td>");
-#if 0
-  int i;
-  babl_log ("\t\tplanar=%i", babl->format.planar);
-  babl_log ("\t\tbands=%i",  babl->format.bands);
-
-  for (i=0; i< babl->format.bands; i++)
-    {
-      babl_log ("\t\tband[%i] type='%s' component='%s' sampling='%s'",
-                i,   babl->format.type[i]->instance.name,
-                     babl->format.component[i]->instance.name,
-                     babl->format.sampling[i]->instance.name);
-    }
-#endif
+  printf ("</table></dd></dl>");
 }